﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4_传参及可空类型
{
    class FuncAndType
    {
        public int FindMax(int x, int y) {
            int maxNum;

            if (x > y) { 
            maxNum = x;
            }
            else{
                maxNum = y;
            }
            return maxNum;
        }
        // out参数
        public void OutFunc(out int x, out int y) {
            x = 0; y = 0;
            x += 1;
            y += 1;
        }



        public static void Main(string[] args) { 
        FuncAndType f = new FuncAndType();
            Console.WriteLine($"最大的值为{f.FindMax(1, 2)}");
            int a = 10;
            int b =11;
            Console.WriteLine($"a原来值为{a}");
            Console.WriteLine($"a原来值为{b}");
            f.OutFunc(out a, out b);
            Console.WriteLine($"经过out参数处理，现在的a值为{a}");
            Console.WriteLine($"经过out参数处理，现在的b值为{b}");

            int? intNumber = null;
            int? intNumber2 = 45;
            double? doubleNumber = new double?();
            double? doubleNumber2 = 3.14157;

            bool? boolNumber = new bool?();
            Console.WriteLine($"{intNumber}-{intNumber2}-{doubleNumber}-{doubleNumber2}-{boolNumber}");

            double doubleNum3;

            doubleNum3 = (intNumber2 > intNumber) ? 3.17:3.18;
            Console.WriteLine($"经三元表达式doubleNum3值为{doubleNum3}");


        }

    }

}
